package edu.scau.pos.domain;

import edu.scau.pos.vo.CategoryVo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Tag(name = "分类", description = "分类domian")
@Data
public class Category implements Serializable {
    private static final long serialVersionUID = 1L;
    @Schema(name = "categoryId", description = "分类id",type = "Long",required = true)
    private Long categoryId;
    @Schema(name = "categorySn",description = "分类编码", type = "String")
    private String categorySn;
    @Schema(name = "categoryName",description = "分类名称", type = "String")
    private String categoryName;
    @Schema(name = "is_deleted",description = "逻辑删除 (0: 未删除, 1: 已删除)", type = "int")
    private int is_deleted;
    @Schema(name = "parent",description = "父分类(0:无分类, 1:  2:  ), 数据库字段问题所以0是无分类", type = "int")
    private int parent;
    @Schema(name = "createTime",description = "创建时间:不返回该数据", type = "Date")
    private Date createTime;
    @Schema(name = "createBy",description = "创建者:不返回该数据", type = "String")
    private String createBy;
    @Schema(name = "updateTime",description = "更新时间:不返回该数据", type = "Date")
    private Date updateTime;
    @Schema(name = "updateBy",description = "更新者:不返回该数据", type = "String")
    private String updateBy;

    public Category(Long categoryId, String categorySn, String categoryName, int is_deleted, int parent, Date createTime, String createBy, Date updateTime, String updateBy) {
        this.categoryId = categoryId;
        this.categorySn = categorySn;
        this.categoryName = categoryName;
        this.is_deleted = is_deleted;
        this.parent = parent;
        this.createTime = createTime;
        this.createBy = createBy;
        this.updateTime = updateTime;
        this.updateBy = updateBy;
    }

    public Category() {
    }

    public Category(CategoryVo categoryVo) {
        this.categoryId=categoryVo.getCategoryId();
        this.categorySn=categoryVo.getCategorySn();
        this.categoryName=categoryVo.getCategoryName();
        this.parent=categoryVo.getParent();
    }
}
